{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We start with..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hello World!\r\n"
     ]
    }
   ],
   "source": [
    "Console.WriteLine(\"Hello World!\");"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Then we do a plot with Plotly, following the [Plotting with XPlot](https://github.com/dotnet/interactive/blob/master/NotebookExamples/csharp/Docs/Plotting%20with%20Xplot.ipynb) example from `dotnet/interactive`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div id=\"9a70b50f-ec94-4c20-8fa8-e14290eb0440\" style=\"width: 900px; height: 500px;\"></div>\r\n",
       "<script type=\"text/javascript\">\r\n",
       "\r\n",
       "var renderPlotly = function() {\r\n",
       "    var xplotRequire = requirejs.config({context:'xplot-3.0.1',paths:{plotly:'https://cdn.plot.ly/plotly-1.49.2.min'}});\r\n",
       "    xplotRequire(['plotly'], function(Plotly) {\r\n",
       "\n",
       "            var data = [{\"type\":\"bar\",\"x\":[\"A\",\"B\",\"C\"],\"y\":[1,3,2],\"name\":\"Bar\"}];\n",
       "            var layout = {\"title\":\"A bar plot\"};\n",
       "            Plotly.newPlot('9a70b50f-ec94-4c20-8fa8-e14290eb0440', data, layout);\n",
       "        \r\n",
       "});\r\n",
       "};\r\n",
       "if ((typeof(requirejs) !==  typeof(Function)) || (typeof(requirejs.config) !== typeof(Function))) { \r\n",
       "    var script = document.createElement(\"script\"); \r\n",
       "    script.setAttribute(\"src\", \"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js\"); \r\n",
       "    script.onload = function(){\r\n",
       "        renderPlotly();\r\n",
       "    };\r\n",
       "    document.getElementsByTagName(\"head\")[0].appendChild(script); \r\n",
       "}\r\n",
       "else {\r\n",
       "    renderPlotly();\r\n",
       "}\r\n",
       "</script>\r\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "using XPlot.Plotly;\n",
    "\n",
    "var bar = new Graph.Bar\n",
    "{\n",
    "    name = \"Bar\",\n",
    "    x = new[] {'A', 'B', 'C'},\n",
    "    y = new[] {1, 3, 2}\n",
    "};\n",
    "\n",
    "var chart = Chart.Plot(new[] {bar});\n",
    "chart.WithTitle(\"A bar plot\");\n",
    "display(chart);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We also test the math outputs as in the [Math and Latex](https://github.com/dotnet/interactive/blob/master/NotebookExamples/csharp/Docs/Math%20and%20LaTeX.ipynb) example:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "\\begin{align} e^{i \\pi} = -1\\end{align}"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(LaTeXString)@\"\\begin{align} e^{i \\pi} = -1\\end{align}\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$e^{i \\pi} = -1$$"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(MathString)@\"e^{i \\pi} = -1\""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".NET (C#)",
   "language": "C#",
   "name": ".net-csharp"
  },
  "language_info": {
   "file_extension": ".cs",
   "mimetype": "text/x-csharp",
   "name": "C#",
   "pygments_lexer": "csharp",
   "version": "8.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
